package lab02.test13;

public class Gymnastics extends ComputerAverage{
         //去掉一个最低分，去掉一个最高分，

    @Override

    double average(double[] scores) {
        double average = 0;

        double sum = 0;

        double intermediary;

        for (int j = 0; j < scores.length; j++) {

            for (int i = 0; i < scores.length - j - 1; i++) {

                if (scores[i] > scores[i + 1]) {

                    intermediary = scores[i];

                    scores[i] = scores[i + 1];

                    scores[i + 1] = intermediary;
                }

            }

        }

        for (int j = 1; j < scores.length - 1; j++) {
            sum = sum + scores[j];
        }
        average = sum / (scores.length - 2);
        return 0;
    }

}
